//this file is the main file
#include "HttpdServer.hpp"
#include "ThreadPool.hpp"

static void Usage(std::string proc_){
    std::cout<<"Usage :"<<proc_<<" port"<<std::endl;
}

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }
    
    signal(SIGPIPE, NULL); 

    HttpdServer *serp = new HttpdServer(atoi(argv[1]));
    serp->InitServer();
    LOG(INFO, "Init is over");
    ThreadPool* tp_ = new ThreadPool;
    daemon(0, 0);
    tp_->InitThreadPool();
    serp->Start(tp_);
    delete serp;
    delete tp_;
    return 0;
}
